import request from '@/router/axios';

// 分页查询产品与工段绑定关系
export const getList = (current, size, params) => {
  return request({
    url: '/api/mes-product/part-master-section/page',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

// 新增、修改产品与工段绑定关系
export const update = (row) => {
  return request({
    url: '/api/mes-product/part-master-section/submit',
    method: 'post',
    data: row
  });
};

export const remove = (ids) => {
  return request({
    url: '/api/mes-product/part-master-section/remove',
    method: 'get',
    params: {
      productPartIds: ids
    }
  });
};

export const getAllSection = (current, size) => {
  return request({
    url: '/api/mes-product/work-section/page',
    method: 'get',
    params: {
      current,
      size
    }
  });
};

export const getDetail = (id) => {
  return request({
    url: '/api/mes-product/part-master-section/detail-by-product-part-id',
    method: 'get',
    params: {
      productPartId: id
    }
  });
};

export const enable = (id) => {
  return request({
    url: '/api/mes-product/part-master-section/enable',
    method: 'get',
    params: {
      productPartIds: id
    }
  });
};

export const disable = (id) => {
  return request({
    url: '/api/mes-product/part-master-section/disable',
    method: 'get',
    params: {
      productPartIds: id
    }
  });
};
